<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>路政执法</title>
<link href="${ctx}/ui/pre/login/css/jcy_style.css" rel="stylesheet" type="text/css">
<!-- 引入jQuery -->
<script src="${ctx}/ui/jslib/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
<!-- 扩展jQuery -->
<script type="text/javascript" src="${ctx}/ui/jslib/extJquery.js?v=201305301341" charset="utf-8"></script>
<script type="text/javascript">
    document.onkeydown=function() {
    	if(event.keyCode==13) {
    		formSubmit();
    	}
   	}
    
    function formSubmit(){
        var ajaxCallUrl = '${ctx}/user/logins';
        var name = $("#name").val();
        var pass = $("#pass").val();
        if(name!=''){
            $.ajax({
                type: "POST",
                url:ajaxCallUrl,
                data:$.serializeObject($('#logins')),
                async: false,
                error: function(request) {
                	alert("用户名或密码错误!");
                },
                success: function(data) {
                    if(data.success){
                        self.location = '${ctx}/user/toIndex.shtml';
                    }else{
                        alert(data.msg);
                        $("#name").val('');
                        $("#pass").val('');
                    }
                }
            });
        }else{
            $("#name").val('');
            $("#pass").val('');
        }
    }
    function clearInfo(){
        $("#name").val('');
        $("#pass").val('');
    }
    </script>
</head>

<body>
<div class="main">
<div class="login_bt"></div>
<div class="logon_box">
<form id="logins">
  <table width="70%" height="78" border="0" cellspacing="0" style="margin:30px auto 0 auto;">
    <tr>
      <td width="17%" height="54">账　号：</td>
      <td width="49%"><input type="text" name="username" id="name" style="width:180px; height:22px; border:1px solid #7f9db9;" /></td>
      <td width="34%" rowspan="3">
	      <a onclick="formSubmit()" style="cursor:pointer;">
	      	<img src="${ctx}/ui/pre/login/images/login_dl.png" width="119" height="95" />
	      </a>
      </td>
    </tr>
    <tr>
      <td>密　码：</td>
      <td><input type="password" name="password" id="pass" style="width:180px; height:22px; border:1px solid #7f9db9;" /></td>
      </tr>
  </table>
</form>
</div>

</div>
</body>
</html>